package com.soft2018;

// 猫类，继承自Pet
public class Cat extends Pet{
    //TODO:字段
    private int legs;
    //TODO:取值器赋值器

    public void setLegs(int legs) {
        this.legs = legs;
    }

    public int getLegs() {
        return legs;
    }
    //TODO:构造器
    public Cat(){}
    public Cat(String name,int age,String color,int legs)
    {
        super(name,age,color);
        this.setKind("猫");
        this.legs = legs;
    }
    //TODO:操作方法
    public void catch_mouse(){
        System.out.println(this.getName()+"抓到一只大老鼠！");
    }
    // 覆盖父类print()方法
    public void print(){
        super.print();
        System.out.println("有"+this.legs+"条腿。");
    }

}
